package com.example.springsession.starterautoconfig.config;

import com.example.springsession.starterautoconfig.filter.LogFilter;
import com.example.springsession.starterautoconfig.filter.LogFilterRegistrationBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 定义自动配置类将LogFilterRegistrationBean 注入到spring上下文中
 */
@Configuration
@ConditionalOnClass({LogFilterRegistrationBean.class})
    public class LogFilterAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean(LogFilterRegistrationBean.class)
    public LogFilterRegistrationBean logFilterRegistrationBean () {
        return new LogFilterRegistrationBean();
    }
}
